package com.hzdp.web.action;

import org.springframework.beans.factory.annotation.Autowired;

import com.hzdp.entity.UserAccount;
import com.hzdp.user.service.UserAccountService;

public class IndexAction extends BaseAction {

	private UserAccount userAccount;

	@Autowired
	private UserAccountService userAccountService;

	@Override
	public String execute() {
		userAccount = findUserAccount();
		return super.execute();
	}

	private UserAccount findUserAccount() {
		UserAccount userAccount = null;
		int userId = getUserId();
		if (userId > 0) {
			userAccount = userAccountService.findById(userId);
		}
		return userAccount;
	}

	public UserAccount getUserAccount() {
		return userAccount;
	}

}
